home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / TCP_IP / TNOS230S / MKDEP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-29  |  1.2 KB  |  52 lines

  1. /* Simple-minded program that generates dependencies for a makefile.
  2.  * Does not process #ifdefs, so some spurious dependencies may be
  3.  * generated.
  4.  *
  5.  * Copyright 1991 Phil Karn, KA9Q
  6.  */
  7. #include <stdio.h>
  8. #include <string.h>
  9.  
  10. #if !defined(_lint)
  11. static char rcsid[] OPTIONAL = "$Id: mkdep.c,v 1.7 1996/08/29 12:11:16 root Exp root $";
  12. #endif
  13.  
  14. char include[] = "#include";
  15. main(argc,argv)
  16. int argc;
  17. char *argv[];
  18. {
  19.     int i;
  20.     FILE *fp;
  21.     char buf[512],*cp,*cp1;
  22.  
  23.     for(i=1;i<argc;i++){
  24.         /* this is a SPECIFIC fix for ignoring MKNAME.C */
  25.         /* this is needed since there is a special compile
  26.            flag needed for this file */
  27.         if (!stricmp ("mkname.c", argv[i]))
  28.             continue;
  29.         strcpy(buf,argv[i]);
  30.         if((cp = strchr(buf,'.')) == NULL)
  31.             continue;
  32.         *cp = '\0';
  33.         printf("%s.obj: %s",buf,argv[i]);
  34.         fp = fopen(argv[i],"r");
  35.         while(fgets(buf,512,fp) != NULL){
  36.             if(strncmp(buf,include,sizeof(include)-1) != 0)
  37.                 continue;
  38.             if((cp = strchr(buf,'\"')) == NULL)
  39.                 continue;
  40.             cp++;
  41.             if((cp1 = strchr(cp,'\"')) == NULL)
  42.                 continue;
  43.             putchar(' ');
  44.             while(cp != cp1)
  45.                 putchar(*cp++);
  46.         }
  47.         putchar('\n');
  48.         fclose(fp);
  49.     }
  50.     return 0;
  51. }
  52.